package cn.xaut.周赛.m227;

/**
 * 5673. 移除石子的最大得分
 */
public class demo5673 {

    public int maximumScore(int a, int b, int c) {

        return maximumScore(a, b, c, 0);
    }

    public int maximumScore(int a, int b, int c, int score) {
        
        // 递归终止条件
        if (a + b == 0 || a + c == 0 || b + c == 0)
            return 0;
        
        // 递归过程
        int m1 = maximumScore(a - 1, b - 1, c, score + 1);
        int m2 = maximumScore(a - 1, b, c - 1, score + 1);
        int m3 = maximumScore(a, b - 1, c - 1, score + 1);
        return Math.max(Math.max(m1, m2), m3);
    }

    public static void main(String[] args) {

        System.out.println(new demo5673().maximumScore(2, 4, 6));
        System.out.println(new demo5673().maximumScore(4, 4, 6));
        System.out.println(new demo5673().maximumScore(1, 8, 8));
    }
}
